package com.linkhub.oms.component.trace.config;

import com.linkhub.oms.component.trace.config.filter.TraceWebFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered;

/**
 * @Description: TraceIdFilterConfiguration
 * @Author: echo
 * @Date: 2022/9/3 22:29
 * @Version: 1.0
 */
@Configuration
public class TraceWebConfiguration {


    @Bean
    public FilterRegistrationBean<TraceWebFilter> registryTraceIdFilter() {
        FilterRegistrationBean<TraceWebFilter> logFilter = new FilterRegistrationBean<>();
        logFilter.setFilter(new TraceWebFilter());
        logFilter.addUrlPatterns("/*");
        logFilter.setName("traceWebFilter");
        logFilter.setOrder(Ordered.HIGHEST_PRECEDENCE);
        return logFilter;
    }
}
